<template>
 
        <div class="box">
  <horder class="horder">
    <van-nav-bar title="标题" left-text="返回" left-arrow @click-left="onClickLeft" @click="$router.go(-1)"/>
</horder>
  <main class="main">
    <ul>
        <li>
     <img :src="obj.image" alt="" style="width: 100%;">
     <p>{{ obj.title }}</p>
     <p>￥{{ obj.price }}</p>
        </li>
    </ul>
  </main>
  <van-action-bar>
  <van-action-bar-icon icon="chat-o" text="客服" dot />
  <van-action-bar-icon icon="cart-o" text="购物车" badge="5" />
  <van-action-bar-icon icon="shop-o" text="店铺" badge="12" />
  <van-action-bar-button type="warning" text="加入购物车" @click="add"/>
  <van-action-bar-button type="danger" text="立即购买" />
</van-action-bar>
    </div>
</template>

<script setup>
import api from '@/api/api.js'
import { onMounted } from 'vue'

import { ref } from 'vue'

import { useRouter , useRoute} from 'vue-router';

const obj = ref({})
const router=useRouter()
const route = useRoute()
onMounted(() => {
    api.get('/detail', {
        params: { id: route.params.id }
    }).then(res => {
        obj.value = res.data.data

    })
})
const add=()=>{
    if(localStorage.getItem('token')){

    }else{
        router.push('/dlym')
    }
}
</script>

<style lang="scss" scoped></style>